package com.frank.sboot.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSON;
import com.frank.sboot.blog.model.Blog;
import com.frank.sboot.blog.service.BlogService;

@RequestMapping("/blog")
@Controller
public class BlogController {
	@Autowired
	private BlogService blogService;
	
	@RequestMapping("/all")
	@ResponseBody
	public String all() {
		List<Blog> blogList = blogService.all();
		String result = JSON.toJSONString(blogList);
		return result;
	}
}
